CREATE OR REPLACE FUNCTION corner11_ra(ra DOUBLE PRECISION,de DOUBLE PRECISION,size_ra DOUBLE PRECISION,size_de DOUBLE PRECISION) RETURNS DOUBLE PRECISION IMMUTABLE AS $$
DECLARE 
	cdec DOUBLE PRECISION := corner11_dec(de, size_de);
	d DOUBLE PRECISION DEFAULT 0;
BEGIN
 	IF cdec = 90 THEN
    	d := ra + 90;
  	ELSE
    	d := (ra + (size_ra/2)/ABS(COS(RADIANS(cdec))));
	END IF;
  
	IF d > 360 THEN 
		RETURN (d - 360.);
	ELSE 
		RETURN d;
	END IF;
END;
$$ LANGUAGE 'plpgsql';